package com.mlnx.web.ui.controller;

import com.mlnx.common.entity.Response;
import com.mlnx.ui.pojo.form.WalkReportForm;
import com.mlnx.ui.pojo.vo.WalkReportVO;
import com.mlnx.ui.service.WalkReportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.shan.spring.base.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(value = "六分钟步行接口", tags = {"六分钟步行接口"})
@RestController
@RequestMapping("ui/sixwalk")
public class SixWalkController extends BaseController {

    @Autowired
    private WalkReportService walkReportService;

    @ApiOperation("保存六分钟步行报告")
    @PostMapping(value = "/report")
    public Response saveReport(@RequestBody WalkReportForm walkReportForm) {
        walkReportService.saveReport(walkReportForm);

        return result();
    }

    @ApiOperation("通过ID获取六分钟步行报告")
    @GetMapping(value = "/report/{id}")
    public Response getReportById(@PathVariable("id") Integer id) {
        WalkReportVO walkReportVO = walkReportService.getSixWalkReport(id);

        return result(walkReportVO);
    }


}
